﻿using BCDto.TMS.VehicleTransportBusinessConfig;
using BCService.TMS.Agent.AgentAreaRecord;
using BCService.TMS.VehicleTransportBusinessConfig;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BCTMSRESTful.Controllers.ClientApp.VehicleTransportBusiness
{
    /// <summary>
    /// 车辆运输业务配置
    /// </summary>
    [Route("api/v1/ClientApp/[controller]")]
    [ApiExplorerSettings(GroupName = "ClientApp")]
    [AllowAnonymous]
    public class VehicleTransportBusinessConfigController : ClientAppBaseController
    {
        private readonly IVehicleTransportBusinessConfigService vehicleTransportBusinessConfigService;

        public VehicleTransportBusinessConfigController(IVehicleTransportBusinessConfigService vehicleTransportBusinessConfigService)
        {
            this.vehicleTransportBusinessConfigService = vehicleTransportBusinessConfigService;
        }

        /// <summary>
        /// 获取车辆运输业务配置
        /// </summary>
        /// <param name="countyCode">区县编码</param>
        /// <response code="200">获取车辆运输业务配置</response>
        /// <returns></returns>
        [HttpGet]
        [ProducesResponseType(typeof(IEnumerable<VehicleTransportBusinessConfigViewDto>), 200)]
        public IActionResult Query([FromQuery(Name = "county_code")] string countyCode)
        {
            long? agentRecordId = this.GetAgentRecordIdByCountyCode(countyCode);
            var result = this.vehicleTransportBusinessConfigService.GetList(agentRecordId, countyCode);
            return this.Ok(result);
        }

    }
}
